﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AAA.Algorithm.Data;

namespace AAA.Algorithm.Cluster.HSFC
{
    public class HSFCMapNode : AbstractMapNode
    {
        public override float CalculateSimilarity(INeuron sourceNeuron)
        {
            float fSimilarity = 0;

            try
            {
                for (int i = 0; i < SampleCount; i++)
                {
                    fSimilarity += Similarity.Similarity(sourceNeuron, GetSample(i));
                }
                fSimilarity = SampleCount == 0 ? 0 : fSimilarity / SampleCount;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "," + ex.StackTrace);
            }
            return fSimilarity;
        }
    }
}
